home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
START Magazine
/
START VOL 4 NO 6.st
/
DRIVER.ARC
/
DRIVER.LST
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
UTF-8
Wrap
File List
|
1989-10-11
|
31.5 KB
|
1,517 lines
'
' GFA PRINTER DRIVER
'
' by Know Ware Mfg.
' Copyright 1990 Antic Publishing, Inc.
'
' ===========================================================================
'
Cls
On Error Gosub Fixit
Rez%=Xbios(4)
If Rez%
@Memory
'
Antic$="© 1990 Antic Publishing"
'
@Save_pal
Setcolor 2,0,4,6
Setcolor 1,6,5,0
Dim Pd$(30)
Dim Pd1$(30)
Dim Emess$(7)
'
Message_data:
Data *File Not Found,*Path Not Found,*Access Not Possible,*Invalid Drive I.D.
Data End of File Reached,Diskette Full,Resume Not Possible
Restore Message_data
For I%=1 To 7
Read Emess$(I%)
Next I%
'
Void Bios(11,Bios(11,-1) Or &H10) ! Caps Lock On
@Read_config
@Use_path
If Rez%=2
Deffill 1,2,4
Else
Deffill 0,1,0
Endif
Pbox 0,0,640,200*Rez%
Sget Temp$
@Assign
First_flag%=1
@Title_screen
Entry:
@Main_loop
@Leave
Else
Alrt$="This Program Will *NOT*|Run in Low Resolution !"
Alert 3,Alrt$,1,"QUIT",B%
Endif
Cls
Edit
'
' ================================================================
'
Procedure Title_screen
@Set3
@Dialog3
Return
'
Procedure Main_loop
Repeat
@Set1
@Dialog1
@Translate1
Until Ex1%=Mquit%
Return
'
' ==========================================================
'
Procedure Null
Return
'
Procedure Make
@Set0
@Dialog0
@Translate0
Return
'
Procedure Change
@Blank_array
@Blank_hold_array
@Driver_pick
@Driver_load
Tail_check$=Upper$(Right$(Pfilename$,3))
If Pfilename$<>"" And (Tail_check$="PDA" Or Tail_check$="PDX")
@Par_tran
Change_flag%=1
@Make
Endif
Return
'
Procedure Hcopy
Alrt$="Test the Driver,|Print Out It's Parameters,|or Exit."
Alert 2,Alrt$,0,"TEST|LIST|EXIT",B%
On B% Gosub Print_test,Print_list,Null
Return
'
Procedure Make_path
@Set2
@Dialog2
@Translate2
Return
'
Procedure Make_active
@Active_show
@Driver_pick
@Activate
Return
'
Procedure Leave
Close
@Rsrc_free
@Restore_pal
@Memory_back
Cls
Edit
Return
'
' =============================================================
'
Procedure Set0
'
@Sstate(Tree0%,Cquit%,0)
@Sstate(Tree0%,Credo%,0)
@Sstate(Tree0%,Caccept%,0)
'
If Con_hex%
@Dec_to_hex
Endif
If Con_char%
@Dec_to_char
Endif
@Stext(Tree0%,Cname%,Pd$(2))
For I%=4 To 16
@Stext(Tree0%,I%,Pd$(I%))
@Stext(Tree0%,I%+14,Pd$(I%+14))
Next I%
'
Return
Procedure Dialog0
Do
@Objc_draw(Tree0%,0,6,X0%,Y0%,B0%,H0%)
@Form_do(Tree0%,2)
Ex0%=Dpeek(Gintout)
@Sstate(Tree0%,Ex0%,0)
Exit If Ex0%=Cquit% Or Ex0%=Credo% Or Ex0%=Caccept%
Loop
' Sput Temp$
'
Return
Procedure Translate0
'
If Ex0%=Caccept%
Sput Temp$
@Gem_to_string
If Con_hex%
@Hex_to_dec
Endif
If Con_char%
@Char_to_dec
Endif
@Driver_write
@Blank_array
@Blank_hold_array
Change_flag%=0
Endif
If Ex0%=Credo%
If Change_flag%
Swap Pd1$(),Pd$()
@Par_tran
Endif
@Make
Endif
If Ex0%=Cquit%
Sput Temp$
@Blank_array
@Blank_hold_array
Change_flag%=0
Endif
'
Return
'
' ==========================================================
'
Procedure Set1
'
@Sstate(Tree1%,Mquit%,0)
@Sstate(Tree1%,Mtitle%,0)
@Sstate(Tree1%,Mcreate%,0)
@Sstate(Tree1%,Medit%,0)
@Sstate(Tree1%,Mdelete%,0)
@Sstate(Tree1%,Mhard%,0)
@Sstate(Tree1%,Mpath%,0)
@Sstate(Tree1%,Mactive%,0)
@Sstate(Tree1%,Msetting%,0)
@Sstate(Tree1%,Mhex%,Con_hex%)
@Sstate(Tree1%,Mdec%,Con_dec%)
@Sstate(Tree1%,Mchar%,Con_char%)
'
Return
Procedure Dialog1
Do
@Objc_draw(Tree1%,0,6,X1%,Y1%,B1%,H1%)
@Form_do(Tree1%,0)
Ex1%=Dpeek(Gintout)
@Sstate(Tree1%,Ex1%,0)
Exit If Ex1%=1 Or (Ex1%>3 And Ex1%<8) Or Ex1%=9 Or (Ex1%>13 And Ex1%<17)
Loop
If Ex1%=Mquit%
@Form_dial(2,300,2,40,6*Rez%,X1%,Y1%,B1%,H1%)
Endif
Sput Temp$
'
Return
Procedure Translate1
'
@Gstate(Tree1%,Mhex%,*Con_hex%)
@Gstate(Tree1%,Mdec%,*Con_dec%)
@Gstate(Tree1%,Mchar%,*Con_char%)
'
On Ex1% Gosub Title_screen,Null,Null,Make,Change,File_delete,Hcopy,Null,Make_path,Null,Null,Null,Null,Make_active,Write_config,Leave
'
Return
'
' ============================================================
'
Procedure Set2
'
@Sstate(Tree2%,Dbutton%,0)
@Sstate(Tree2%,Pbutton%,0)
@Sstate(Tree2%,Nbutton%,0)
@Stext(Tree2%,Default%,Right$(Dpath$,37))
@Stext(Tree2%,Expath%,Right$(Present_path$+Path$,37))
@Stext(Tree2%,Newpath%,"")
'
Return
Procedure Dialog2
Do
@Objc_draw(Tree2%,0,6,X2%,Y2%,B2%,H2%)
@Form_do(Tree2%,3)
Ex2%=Dpeek(Gintout)
@Sstate(Tree2%,Ex2%,0)
Exit If Ex2%=Nbutton% Or Ex2%=Pbutton% Or Ex2%=Dbutton%
Loop
Sput Temp$
'
Return
Procedure Translate2
'
@Gtext(Tree2%,Default%,*Dpath$)
@Gtext(Tree2%,Newpath%,*Npath$)
If Ex2%=Nbutton%
Path$=Npath$
Endif
If Ex2%=Dbutton%
Path$=Dpath$
Endif
'
@Use_path
'
Return
'
' =============================================================
'
Procedure Set3
Antic$=Left$(Antic$,34)
@Sstate(Tree3%,Infobut%,0)
@Stext(Tree3%,Ttwo%,Antic$)
Return
'
Procedure Dialog3
Do
If First_flag%
@Form_dial(1,300,2,40,1*Rez%,X3%,Y3%,B3%,H3%)
First_flag%=0
Endif
@Objc_draw(Tree3%,0,6,X3%,Y3%,B3%,H3%)
@Form_do(Tree3%,0)
Ex3%=Dpeek(Gintout)
@Sstate(Tree3%,Ex3%,0)
Exit If Ex3%=Infobut%
Loop
Sput Temp$
'
Return
'
' ===============================================================
Procedure Objc_draw(Tree%,Start%,Depth%,X%,Y%,B%,H%)
Lpoke Addrin,Tree%
Dpoke Gintin,Start%
Dpoke Gintin+2,Depth%
Dpoke Gintin+4,X%
Dpoke Gintin+6,Y%
Dpoke Gintin+8,B%
Dpoke Gintin+10,H%
Gemsys 42
Return
Procedure Form_do(Tree%,Start%)
Lpoke Addrin,Tree%
Dpoke Gintin,Start%
Gemsys 50
Return
Procedure Form_dial(F%,X%,Y%,B%,H%,Xb%,Yb%,Bb%,Hb%)
Dpoke Gintin,F%
Dpoke Gintin+2,X%
Dpoke Gintin+4,Y%
Dpoke Gintin+6,B%
Dpoke Gintin+8,H%
Dpoke Gintin+10,Xb%
Dpoke Gintin+12,Yb%
Dpoke Gintin+14,Bb%
Dpoke Gintin+16,Hb%
Gemsys 51
Return
Procedure Form_center(Tree%)
Lpoke Addrin,Tree%
Gemsys 54
Return
Procedure Rsrc_load(Nam$)
If Not Exist(Nam$)
Alert 3,"The file "+Nam$+" must|be in the same directory|as DRIVER.PRG.",1,"Abort",D
@Restore_pal
@Memory_back
Cls
Edit
Endif
Nam$=Nam$+Chr$(0)
Lpoke Addrin,Varptr(Nam$)
Gemsys 110
R_load_flag%=1
Return
Procedure Rsrc_free
Gemsys 111
Return
Procedure Rsrc_gaddr(Type%,Index%)
Dpoke Gintin,Type%
Dpoke Gintin+2,Index%
Gemsys 112
Return
Procedure Rsrc_gtree(Index_%,Tree.%)
Lpoke Gintin,Index_%
Gemsys 112
*Tree.%=Lpeek(Addrout)
Return
'
Procedure Gstate(T_%,N_%,X.%)
*X.%=Dpeek(T_%+24*N_%+10)
Return
'
Procedure Sstate(T_%,N_%,X_%)
Dpoke T_%+24*N_%+10,X_%
Return
'
Procedure Gtext(T_%,N_%,X.%)
Local X_$
X_$=Space$(100)
T_%=Lpeek(Lpeek(T_%+24*N_%+12))
Bmove T_%,Varptr(X_$),100
*X.%=Left$(X_$,Instr(X_$,Chr$(0))-1)
Return
'
Procedure Stext(T_%,N_%,X_$)
X_$=X_$+Chr$(0)
T_%=Lpeek(T_%+24*N_%+12)
Bmove Varptr(X_$),Lpeek(T_%),Min(Len(X_$),Dpeek(T_%+24)-1)
Return
'
Procedure Memory
Reserve Fre(0)-10000
Return
'
Procedure Memory_back
Reserve Fre(0)+10000-255
Void Fre(0)
Return
'
Procedure Assign
'
Present_path$=" Present Path: "
'
'
Choose%=0 !RSC_TREE
Ctitle%=1 !Obj in #0
Cname%=2 !Obj in #0
Clbox%=3 !Obj in #0
Calign%=4 !Obj in #0
Clinef%=5 !Obj in #0
Cformf%=6 !Obj in #0
Cpagel%=7 !Obj in #0
Citalon%=8 !Obj in #0
Citaloff%=9 !Obj in #0
Cboldon%=10 !Obj in #0
Cboldoff%=11 !Obj in #0
Cdblson%=12 !Obj in #0
Cdblsoff%=13 !Obj in #0
Cundron%=14 !Obj in #0
Cundroff%=15 !Obj in #0
Rtmar1%=16 !Obj in #0
Crbox%=17 !Obj in #0
Csubon%=18 !Obj in #0
Csupon%=19 !Obj in #0
Csuboff%=20 !Obj in #0
Cwideon%=21 !Obj in #0
Cwideoff%=22 !Obj in #0
Cnlq%=23 !Obj in #0
Cdraft%=24 !Obj in #0
C10cpi%=25 !Obj in #0
C12cpi%=26 !Obj in #0
C17cpi%=27 !Obj in #0
C6lpi%=28 !Obj in #0
C8lpi%=29 !Obj in #0
Rtmar2%=30 !Obj in #0
Cquit%=31 !Obj in #0
Credo%=32 !Obj in #0
Caccept%=33 !Obj in #0
'
Mpanel%=1 !RSC_TREE
Mtitle%=1 !Obj in #1
Blurb%=2 !Obj in #1
Mlbox%=3 !Obj in #1
Mcreate%=4 !Obj in #1
Medit%=5 !Obj in #1
Mdelete%=6 !Obj in #1
Mhard%=7 !Obj in #1
Mrbox%=8 !Obj in #1
Mpath%=9 !Obj in #1
Display%=10 !Obj in #1
Mhex%=11 !Obj in #1
Mdec%=12 !Obj in #1
Mchar%=13 !Obj in #1
Mactive%=14 !Obj in #1
Msetting%=15 !Obj in #1
Mquit%=16 !Obj in #1
'
Pathbox%=2 !RSC_TREE
Ptitle%=1 !Obj in #2
Expath%=2 !Obj in #2
Let Newpath%=3 !Obj in #2
Default%=4 !Obj in #2
Dbutton%=5 !Obj in #2
Pbutton%=6 !Obj in #2
Nbutton%=7 !Obj in #2
'
Info%=3 !RSC_TREE
Inborder%=1 !Obj in #3
Tone%=2 !Obj in #3
Ttwo%=3 !Obj in #3
Tthree%=4 !Obj in #3
Tfour%=5 !Obj in #3
Tfive%=6 !Obj in #3
Tsix%=7 !Obj in #3
Infobut%=8 !Obj in #3
'
If Rez%=2
@Rsrc_load("DRIVERH.RSC")
Else
@Rsrc_load("DRIVERM.RSC")
Endif
@Rsrc_gtree(Choose%,*Tree0%)
@Rsrc_gtree(Mpanel%,*Tree1%)
@Rsrc_gtree(Pathbox%,*Tree2%)
@Rsrc_gtree(Info%,*Tree3%)
'
@Form_center(Tree0%)
X0%=Dpeek(Tree0%+16)
Y0%=Dpeek(Tree0%+18)
B0%=Dpeek(Tree0%+20)
H0%=Dpeek(Tree0%+22)
'
@Form_center(Tree1%)
X1%=Dpeek(Tree1%+16)
Y1%=Dpeek(Tree1%+18)
B1%=Dpeek(Tree1%+20)
H1%=Dpeek(Tree1%+22)
'
@Form_center(Tree2%)
X2%=Dpeek(Tree2%+16)
Y2%=Dpeek(Tree2%+18)
B2%=Dpeek(Tree2%+20)
H2%=Dpeek(Tree2%+22)
'
@Form_center(Tree3%)
X3%=Dpeek(Tree3%+16)
Y3%=Dpeek(Tree3%+18)
B3%=Dpeek(Tree3%+20)
H3%=Dpeek(Tree3%+22)
'
Return
'
' =============================================
'
Procedure Read_config
Drive=Gemdos(&H19)
Let Dir$=Dir$(Drive+1)
If Right$(Dir$,1)<>"\"
Let Dir$=Dir$+"\"
Endif
Let Dir$=Mid$("ABCDEFGHIJKLMNOP",Drive+1,1)+":"+Dir$
Cfg_name$=Dir$+"DRIVER.CFG"
'
If Exist(Cfg_name$)=0
Open "O",#1,Cfg_name$
Write #1,Dir$
Write #1,Dir$
Write #1,0
Write #1,1
Write #1,0
Close #1
Endif
Open "I",#1,Cfg_name$
Input #1,Path$
Input #1,Dpath$
Input #1,Con_hex%
Input #1,Con_dec%
Input #1,Con_char%
Close #1
Return
'
Procedure Write_config
Sput Temp$
@Notice_box("Writing Current Settings","to: "+Cfg_name$)
Open "O",#1,Cfg_name$
Write #1,Path$
Write #1,Dpath$
Write #1,Con_hex%
Write #1,Con_dec%
Write #1,Con_char%
Close #1
Sput Temp$
Return
'
' ======================================================
'
Procedure Gem_to_string
@Gtext(Tree0%,Cname%,*Capture$)
Pd$(2)=Capture$
'
I%=3
Repeat
Inc I%
@Gtext(Tree0%,I%,*Capture$)
Pd$(I%)=Capture$
@Gtext(Tree0%,I%+14,*Capture$)
Pd$(I%+14)=Capture$
Until I%=16
'
Return
'
Procedure Dec_to_hex
I%=3
Repeat
Inc I%
@Dec_convert
Until I%=16
I%=17
Repeat
Inc I%
@Dec_convert
Until I%=30
Return
'
Procedure Dec_convert
Jend%=Len(Pd$(I%))
J%=0
Hexhold$=""
If Jend%>0
While J%<=Jend%
Do
Inc J%
Exit If J%>Jend%
Holdit$=Mid$(Pd$(I%),J%,1)
Exit If Holdit$=","
Hold$=Hold$+Holdit$
Loop
Hold$=Hex$(Val(Hold$))
If Len(Hold$)=1
Hold$="0"+Hold$
Endif
Hexhold$=Hexhold$+Hold$+","
Hold$=""
Wend
Pd$(I%)=Left$(Hexhold$,Len(Hexhold$)-1)
Else
Pd$(I%)=""
Endif
Return
'
Procedure Hex_to_dec
I%=3
Repeat
Inc I%
@Hex_convert
Until I%=16
I%=17
Repeat
Inc I%
@Hex_convert
Until I%=30
Return
'
Procedure Hex_convert
Jend%=Len(Pd$(I%))
J%=0
Hexhold$=""
If Jend%>0
While J%<=Jend%
Do
Inc J%
Exit If J%>Jend%
Holdit$=Mid$(Pd$(I%),J%,1)
Exit If Holdit$=","
Hold$=Hold$+Holdit$
Loop
If Left$(Hold$,1)="#"
Hold$=Right$(Hold$,Len(Hold$)-1)
Hexhold$=Hexhold$+Hold$+","
Else
Hold$="&"+Hold$
Hexhold$=Hexhold$+Str$(Val(Hold$))+","
Endif
Hold$=""
Wend
Pd$(I%)=Left$(Hexhold$,Len(Hexhold$)-1)
Else
Pd$(I%)=""
Endif
Return
'
Procedure Char_to_dec
I%=3
Repeat
Inc I%
@Char_convert
Until I%=16
I%=17
Repeat
Inc I%
@Char_convert
Until I%=30
Return
'
Procedure Char_convert
Jend%=Len(Pd$(I%))
J%=0
Charhold$=""
If Jend%>0
While J%<=Jend%
Do
Inc J%
Exit If J%>Jend%
Holdit$=Mid$(Pd$(I%),J%,1)
Exit If Holdit$=","
Hold$=Hold$+Holdit$
Loop
'
If Len(Hold$)=1 And Asc(Hold$)>32
Hold$=Str$(Asc(Hold$))
Else
Uhold$=Upper$(Hold$)
If Uhold$="NUL"
Hold$="0"
Endif
If Uhold$="SOH"
Hold$="1"
Endif
If Uhold$="BEL"
Hold$="7"
Endif
If Uhold$="BS"
Hold$="8"
Endif
If Uhold$="HT"
Hold$="9"
Endif
If Uhold$="LF"
Hold$="10"
Endif
If Uhold$="VT"
Hold$="11"
Endif
If Uhold$="FF"
Hold$="12"
Endif
If Uhold$="CR"
Hold$="13"
Endif
If Uhold$="SO"
Hold$="14"
Endif
If Uhold$="SI"
Hold$="15"
Endif
If Uhold$="DC1"
Hold$="17"
Endif
If Uhold$="DC2"
Hold$="18"
Endif
If Uhold$="DC3"
Hold$="19"
Endif
If Uhold$="DC4"
Hold$="20"
Endif
If Uhold$="CAN"
Hold$="24"
Endif
If Uhold$="ESC"
Hold$="27"
Endif
If Uhold$="SP"
Hold$="32"
Endif
If Left$(Hold$,1)="#"
Hold$=Mid$(Hold$,2,Len(Hold$)-1)
Endif
Endif
'
Charhold$=Charhold$+Hold$+","
Hold$=""
Wend
Pd$(I%)=Left$(Charhold$,Len(Charhold$)-1)
Else
Pd$(I%)=""
Endif
Return
'
Procedure Dec_to_char
I%=3
Repeat
Inc I%
@Cd_convert
Until I%=16
I%=17
Repeat
Inc I%
@Cd_convert
Until I%=30
Return
'
Procedure Cd_convert
Jend%=Len(Pd$(I%))
J%=0
Charhold$=""
If Jend%>0
While J%<=Jend%
Do
Inc J%
Exit If J%>Jend%
Holdit$=Mid$(Pd$(I%),J%,1)
Exit If Holdit$=","
Hold$=Hold$+Holdit$
Loop
'
Vh%=Val(Hold$)
If Vh%<33 And ((Vh%>-1 And Vh%<2) Or (Vh%>6 And Vh%<16) Or (Vh%>16 And Vh%<21) Or (Vh%=24) Or (Vh%=27) Or (Vh%=32))
If Hold$="0"
Hold$="NUL"
Endif
If Hold$="1"
Hold$="SOH"
Endif
If Hold$="7"
Hold$="BEL"
Endif
If Hold$="8"
Hold$="BS"
Endif
If Hold$="9"
Hold$="HT"
Endif
If Hold$="10"
Hold$="LF"
Endif
If Hold$="11"
Hold$="VT"
Endif
If Hold$="12"
Hold$="FF"
Endif
If Hold$="13"
Hold$="CR"
Endif
If Hold$="14"
Hold$="SO"
Endif
If Hold$="15"
Hold$="SI"
Endif
If Hold$="17"
Hold$="DC1"
Endif
If Hold$="18"
Hold$="DC2"
Endif
If Hold$="19"
Hold$="DC3"
Endif
If Hold$="20"
Hold$="DC4"
Endif
If Hold$="24"
Hold$="CAN"
Endif
If Hold$="27"
Hold$="ESC"
Endif
If Hold$="32"
Hold$="SP"
Endif
Else
Hold$=Chr$(Val(Hold$))
Endif
'
Charhold$=Charhold$+Hold$+","
Hold$=""
Wend
Pd$(I%)=Left$(Charhold$,Len(Charhold$)-1)
Else
Pd$(I%)=""
Endif
Return
'
' =====================================================
'
Procedure Notice_box(Dt$,Filename$)
'
Local Sx%,Sy%,Ex%,Ey%,Ldt%,Lfname%
Ldt%=Len(Dt$)
Lfname%=Len(Filename$)
'
Mlen%=((Max(Ldt%,Lfname%))*8)+60
Dif%=(640-Mlen%)/2
Sx%=Dif%
Sy%=60*Rez%
Ex%=640-Dif%
Ey%=140*Rez%
'
Deffill 0,1,0
Pbox Sx%,Sy%,Ex%,Ey%
Box Sx%,Sy%,Ex%,Ey%
Defline 1,3,0,0
Box Sx%+6,Sy%+4,Ex%-6,Ey%-4
Line Sx%+4,Sy%+4,Sx%+6,Sy%+4
Center%=((80-Ldt%)/2)+1
Print At(Center%,11);Dt$
Center%=((80-Lfname%)/2)+1
Print At(Center%,14);Filename$
'
Defline 1,1,0,0
Return
'
' ========================================================
'
Procedure Driver_pick
'
If Upath$=""
@Find_path("\*.PD?")
Else
D$=Upath$+"*.PD?"
Endif
@Select_file
Return
'
Procedure Driver_load
Tail_check$=Upper$(Right$(Pfilename$,3))
If Pfilename$<>"" And (Tail_check$="PDA" Or Tail_check$="PDX")
Defmouse 2
@Notice_box("Loading Printer Driver:",Pfilename$)
@Blank_array
@Driver_read
Defmouse 0
Sput Temp$
Endif
'
Return
'
' ===========================================================
'
Procedure Find_path(Tail$)
Path_name$=Dir$(0)
Drive=Gemdos(&H19)
Drive$=Chr$(Drive+65)
D$=Drive$+":"+Path_name$+Tail$
Return
'
'
Procedure Select_file
Fileselect D$,B$,Pfilename$
If Pfilename$<>""
If Exist(Pfilename$)=0
Alrt$="| File doesn't exist!"
Alert 1,Alrt$,1," O.K. ",B%
Pfilename$=""
Endif
Else
Pfilename$=""
Endif
Return
'
'
Procedure File_delete
'
If Upath$=""
@Find_path("\*.*")
Else
D$=Upath$+"*.*"
Endif
@Select_file
If Pfilename$<>""
B%=0
If Exist(Pfilename$) And Len(Pfilename$)>5
Del1$=Right$(Pfilename$,30)
Alrt$="Are you SURE about deleting| |"+Del1$
Alert 3,Alrt$,2,"DELETE|CANCEL",B%
Endif
If B%=1
Defmouse 2
@Notice_box("Deleting File:",Pfilename$)
Kill Pfilename$
Defmouse 0
Pfilename$=""
Sput Temp$
Endif
Endif
'
Return
'
' =============================================================
Procedure Driver_read
Tail_check$=Upper$(Right$(Pfilename$,3))
If Pfilename$<>"" And (Tail_check$="PDA" Or Tail_check$="PDX")
Open "I",#1,Pfilename$
For I%=4 To 16
Line Input #1,Pd$(I%)
Next I%
For I%=18 To 30
Line Input #1,Pd$(I%)
Next I%
Close #1
'
Rhold%=0
Rphold%=0
Repeat
Rhold%=Instr(Rphold%+1,Pfilename$,"\")
Rphold%=Max(Rphold%,Rhold%)
Until Rhold%=0
Pd$(2)=Right$(Pfilename$,Len(Pfilename$)-Rphold%)
Pd$(2)=Left$(Pd$(2),Len(Pd$(2))-4)
Endif
Return
'
Procedure Par_tran
I%=0
Repeat
Inc I%
Pd1$(I%)=Pd$(I%)
Until I%=30
Return
'
' ===============================================================
'
Procedure Driver_write
If Len(Pd$(2))=0
Pd$(2)="UNKNOWN"
Endif
@Use_path
Pfilename$=Upath$+Pd$(2)+".PDX"
Defmouse 2
Afilename$=Pfilename$
Mid$(Afilename$,Len(Afilename$)-2)="PDA"
If Exist(Afilename$)
Name Afilename$ As Pfilename$
Endif
'
If Exist(Pfilename$)
Filebak$=Pfilename$
Mid$(Filebak$,Len(Filebak$)-2)="BAK"
If Exist(Filebak$)
Kill Filebak$
Endif
Name Pfilename$ As Filebak$
Endif
@Notice_box("Saving Printer Driver:",Pfilename$)
Open "O",#1,Pfilename$
For I%=4 To 16
Print #1,Pd$(I%)
Next I%
For I%=18 To 30
Print #1,Pd$(I%)
Next I%
Close #1
Defmouse 0
Sput Temp$
@Blank_array
Return
'
Procedure Blank_array
I%=-1
Repeat
Inc I%
Pd$(I%)=""
Until I%=30
Return
'
Procedure Blank_hold_array
I%=-1
Repeat
Inc I%
Pd1$(I%)=""
Until I%=30
Return
'
Procedure Active_show
'
If Upath$=""
@Find_path("\*.PDA")
Else
D$=Upath$+"*.PDA"
Endif
Return
'
Procedure Activate
Sput Temp$
Tail_check$=Upper$(Right$(Pfilename$,3))
If Pfilename$<>"" And (Tail_check$="PDA" Or Tail_check$="PDX")
Nname$=Pfilename$
Rname$=Pfilename$
Mid$(Rname$,Len(Rname$))="A"
@Notice_box("Active Printer Driver:",Rname$)
If Pfilename$<>Rname$
Name Pfilename$ As Rname$
Endif
Rhold%=0
Rphold%=0
Repeat
Rhold%=Instr(Rphold%+1,Nname$,"\")
Rphold%=Max(Rphold%,Rhold%)
Until Rhold%=0
Rpath$=Left$(Nname$,Rphold%)
Nname$=Rpath$+"*.PD?"
Dir Nname$ To "TEMP1.ZZZ"
Open "I",#1,"TEMP1.ZZZ"
Do
Line Input #1,Fhold$
Fhold$=Upper$(Rpath$+Fhold$)
Nhold$=Fhold$
Mid$(Nhold$,Len(Nhold$))="X"
If Fhold$<>Nhold$ And Fhold$<>Rname$
Name Fhold$ As Nhold$
Endif
Exit If Eof(#1)
Loop
Close #1
Kill "TEMP1.ZZZ"
'
Endif
Sput Temp$
Return
'
' ======================================================================
'
Procedure Get_driver
@Active_show
D_flag%=0
Test_name$=Space$(20)
Void Gemdos(26,L:Basepage+128)
Fd$=D$+Chr$(0)
E_%=Gemdos(78,L:Varptr(Fd$),Attr%)
If E_%=0
Open "I",#1,D$
D_flag%=1
Bmove Basepage+158,Varptr(Test_name$),14
Test_name$=Left$(Test_name$,Instr(Test_name$,Chr$(0))-1)
Endif
@Para_to_char(*Align$)
@Para_to_char(*Linef$)
If D_flag%=0
Let Linef$=Chr$(10)
Endif
@Para_to_char(*Formf$)
If D_flag%=0
Let Formf$=Chr$(12)
Endif
@Para_to_char(*Pagel$)
@Para_to_char(*Italon$)
@Para_to_char(*Italoff$)
@Para_to_char(*Boldon$)
@Para_to_char(*Boldoff$)
@Para_to_char(*Dblon$)
@Para_to_char(*Dbloff$)
@Para_to_char(*Undron$)
@Para_to_char(*Undroff$)
@Para_to_char(*Rtmar1$)
@Para_to_char(*Subon$)
@Para_to_char(*Supon$)
@Para_to_char(*Suboff$)
@Para_to_char(*Wideon$)
@Para_to_char(*Wideoff$)
@Para_to_char(*Nlq$)
@Para_to_char(*Draft$)
@Para_to_char(*Cpi10$)
@Para_to_char(*Cpi12$)
@Para_to_char(*Cpi17$)
@Para_to_char(*Lpi6$)
@Para_to_char(*Lpi8$)
@Para_to_char(*Rtmar2$)
If D_flag%
Close #1
Endif
Return
'
' ======================================================================
Procedure Para_to_char(Para_hold%)
Local Hold$
Local Holdit$
If D_flag%
Line Input #1,Ihold$
Jend%=Len(Ihold$)
J%=0
Prhold$=""
If Jend%>0
While J%<=Jend%
Do
Inc J%
Exit If J%>Jend%
Holdit$=Mid$(Ihold$,J%,1)
Exit If Holdit$=","
Hold$=Hold$+Holdit$
Loop
Prhold$=Prhold$+Chr$(Val(Hold$))
Hold$=""
Wend
*Para_hold%=Prhold$
Else
*Para_hold%=""
Endif
Else
*Para_hold%=""
Endif
Return
'
' ==============================================================
'
Procedure Use_path
Upath$=Path$
If Path$=""
Upath$=Dpath$
Endif
If Dpath$=""
@Find_path("\")
Upath$=Drive$+":"+Path_name$+Tail$
Endif
If Right$(Upath$,1)<>"\"
Upath$=Upath$+"\"
Endif
Return
'
' ==============================================================
Procedure Fixit
Mess$=""
If Err=-33
Mess$=Emess$(1)
Endif
If Err=-34
Mess$=Emess$(2)
Endif
If Err=-36
Mess$=Emess$(3)
Endif
If Err=-46
Mess$=Emess$(4)
Endif
If Err=26
Mess$=Emess$(5)
Endif
If Err=37
Mess$=Emess$(6)
Endif
If Err=92
Mess$=Emess$(7)
Endif
'
If Mess$<>""
Alrt$=Mess$
Alert 3,Alrt$,0,"QUIT|CONTINUE",Er%
Else
Alrt$="Error #"+Str$(Err)+" | |Sorry !"
Alert 3,Alrt$,1,"OOOPS!",Er%
Endif
Close
If Er%=2
Sput Temp$
@Blank_array
On Error Gosub Fixit
Resume Entry
Endif
If Er%=1
If R_load_flag%
@Rsrc_free
Endif
@Restore_pal
@Memory_back
Edit
Endif
Return
'
' =============================================================
'
Procedure Print_list
@Get_driver
@Driver_pick
@Driver_load
@Driver_print
Return
'
Procedure Driver_print
'
Sput Temp$
Tail_check$=Upper$(Right$(Pfilename$,3))
If Pfilename$<>"" And (Tail_check$="PDA" Or Tail_check$="PDX")
Title_data:
Data "Align (Reset): ","Line Feed: ","Form Feed: ","Page Length: "
Data "Italic Print On: ","Italic Print Off: ","Bold Print On: ","Bold Print Off: "
Data "Double Strike On: ","Double Strike Off: ","Underline On: ","Underline Off: ","Right Margin 1: "
Data "Subscript On: ","Superscript On: ","Sub/Superscript Off: ","Wide Print On: "
Data "Wide Print Off: ","Nlq On: ","Draft On: ","10 Cpi: ","12 Cpi: ","17 Cpi: "
Data "6 Lines/Inch: ","8 Lines/Inch: ","Right Margin 2: "
'
@Check_printer
If Printer%
'
Alrt$=" |Align Paper to Top of Form"
Alert 1,Alrt$,2,"O.K.|EXIT",B%
If B%=1
@Notice_box("Hardcopy of Driver:",Pfilename$)
If Con_hex%
@Dec_to_hex
Endif
If Con_char%
@Dec_to_char
Endif
'
Erase Tdata$()
Dim Tdata$(26)
Restore Title_data
I%=0
Repeat
Inc I%
Read Tdata$(I%)
Until I%=26
'
I%=3
Blank%=0
Repeat
Inc I%
Blank%=Max(Blank%,Len(Pd$(I%)+Tdata$(I%-3)))
Until I%=16
'
I%=17
Blank2%=0
Repeat
Inc I%
Blank2%=Max(Blank2%,Len(Pd$(I%)+Tdata$(I%-4)))
Until I%=30
'
Full_len%=Max(Blank%,Blank2%)
Half_flag%=0
If Full_len%<31
Half_flag%=1
Col_lead$=Space$(35-Blank%)
Back_space%=75-Blank2%
Gap$=Space$(Back_space%-(Len(Col_lead$)+Blank%))
I%=0
Repeat
Inc I%
Pd$(I%+3)=Pd$(I%+3)+Space$(Blank%-(Len(Pd$(I%+3))+Len(Tdata$(I%))))
Until I%=13
'
Else
Col_lead$=Space$(Int((80-Full_len%)/2+1))
Gap$=""
Endif
'
Title_line$="GFA PRINTER DRIVER"
Para_line$="PRINTER PARAMETERS FOR "+Pd$(2)
Lead1%=(80-Len(Title_line$))/2+1
Lead2%=(80-Len(Para_line$))/2+1
Title_line$=Space$(Lead1%)+Title_line$
Para_line$=Space$(Lead2%)+Para_line$
'
Lprint Align$;Pagel$;Draft$;Cpi10$;Lpi6$;
Lprint Linef$
Lprint Linef$
Lprint Boldon$;
Lprint Title_line$
Lprint Linef$
Lprint Para_line$
Lprint Boldoff$;Cpi10$;Lpi6$;
If Half_flag%
Lprint Linef$
Endif
Lprint Linef$
For I%=4 To 16
If Half_flag%
Lprint Col_lead$;Tdata$(I%-3);Boldon$;Pd$(I%);Boldoff$;Gap$;Tdata$(I%+10);Boldon$;Pd$(I%+14);Boldoff$
Else
Lprint Col_lead$;Tdata$(I%-3);Boldon$;Pd$(I%);Boldoff$
Endif
Lprint Linef$;
Next I%
If Half_flag%=0
For I%=18 To 30
Lprint Col_lead$;Tdata$(I%-4);Boldon$;Pd$(I%);Boldoff$
Lprint Linef$;
Next I%
Endif
Lprint Formf$;
Lprint Align$;
Erase Tdata$()
Sput Temp$
Endif
Endif
Endif
@Blank_array
Return
'
' =============================================================
'
Procedure Print_test
@Check_printer
If Printer%
@Get_driver
If D_flag%
@Check_printer
If Printer%
'
Alrt$=" |Align Paper to Top of Form"
Alert 1,Alrt$,2,"O.K.|EXIT",B%
If B%=1
@Notice_box("Running Driver Test:",Test_name$)
If Con_hex%
@Dec_to_hex
Endif
If Con_char%
@Dec_to_char
Endif
@Test_form
Endif
Endif
Else
Alrt$="No Active Driver Has Been|Found. Make a Driver Active|Before Running This Test."
Alert 3,Alrt$,1," O.K. ",B%
Endif
Endif
'
Return
'
Procedure Test_form
Let Line80$=String$(80,"-")
Lprint Align$;Pagel$;Draft$;Cpi10$;Lpi6$;
Lprint "-----------------------THIS IS THE FIRST LINE ON THE PAGE----------------------"
For I%=1 To 3
Lprint
Next I%
Lprint "Testing Printer Driver: ";Test_name$
Lprint
Lprint "6 LPI, 10 CPI, DRAFT"
@Test_lines
Lprint
Lprint Draft$;Lpi6$;Cpi12$;
Lprint "6 LPI, 12 CPI, DRAFT"
@Test_lines
Lprint
Lprint Draft$;Lpi6$;Cpi17$;
Lprint "6 LPI, 17 CPI, DRAFT"
@Test_lines
Lprint
Lprint Nlq$;Lpi6$;Cpi10$;
Lprint "6 LPI, 10 CPI, NLQ"
@Test_lines
Lprint
Lprint Nlq$;Lpi6$;Cpi12$;
Lprint "6 LPI, 12 CPI, NLQ"
@Test_lines
Lprint
Lprint Nlq$;Lpi6$;Cpi17$;
Lprint "6 LPI, 17 CPI, NLQ"
@Test_lines
Lprint
Lprint Draft$;Cpi10$;Lpi6$;
@Test_lines2
Lprint
Lprint "6 LPI, 1 INCH SPACED LINES"
Lprint Line80$
For J%=1 To 3
For I%=1 To 5
Lprint
Next I%
Lprint Line80$
Next J%
Lprint Formf$;
' ==================================================================
Lprint Align$;Pagel$;Draft$;Lpi8$;Cpi10$;
Lprint "--------------------THIS IS THE FIRST LINE ON THE SECOND PAGE-------------------"
For I%=1 To 5
Lprint
Next I%
Lprint "Testing Printer Driver: ";Test_name$
Lprint
Lprint "8 LPI, 10 CPI, DRAFT"
@Test_lines
Lprint
Lprint Draft$;Lpi8$;Cpi12$;
Lprint "8 LPI, 12 CPI, DRAFT"
@Test_lines
Lprint
Lprint Draft$;Lpi8$;Cpi17$;
Lprint "8 LPI, 17 CPI, DRAFT"
@Test_lines
Lprint
Lprint Nlq$;Lpi8$;Cpi10$;
Lprint "8 LPI, 10 CPI, NLQ"
@Test_lines
Lprint
Lprint Nlq$;Lpi8$;Cpi12$;
Lprint "8 LPI, 12 CPI, NLQ"
@Test_lines
Lprint
Lprint Nlq$;Lpi8$;Cpi17$;
Lprint "8 LPI, 17 CPI, NLQ"
@Test_lines
Lprint
Lprint Draft$;Cpi10$;Lpi8$;
@Test_lines2
Lprint
Lprint "8 LPI, 1 INCH SPACED LINES"
Lprint Line80$
For J%=1 To 3
For I%=1 To 7
Lprint
Next I%
Lprint Line80$
Next J%
Lprint Formf$;
Lprint Align$;Cpi10$;Draft$;Lpi6$;
Return
'
Procedure Test_lines
Lprint "0123456789!@#$%^&*()-+='./?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
Lprint "0123456789!@#$%^&*()-+='./?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
Return
'
Procedure Test_lines2
Lprint Italon$;"Italic Print";Italoff$
Lprint Boldon$;"Bold Print";Boldoff$
Lprint Dblon$;"Double Strike";Dbloff$
Lprint Undron$;"Underline";Undroff$
Lprint Subon$;"Subscript";Suboff$
Lprint Supon$;"Superscript";Suboff$
Lprint Wideon$;"Wide Print";Wideoff$
Return
'
' =============================================================
'
Procedure Check_printer
Repeat
B%=1
Let Printer%=Gemdos(17)
If Printer%=0
Alrt$="No Printer is Detected.|Turn it on, or|check the cables !"
Alert 2,Alrt$,0,"O.K.|EXIT",B%
Endif
Until (B%=1 And Printer%) Or B%=2
If B%=2
Let Printer%=0
Endif
Return
'
' ------------- SAVE ORIGINAL COLOR PALETTE -----------------------
Procedure Save_pal
'
Dim Spalette%(16,3)
'
For Z%=0 To 15
Dpoke Contrl,26
Dpoke Contrl+2,0
Dpoke Contrl+6,2
Dpoke Intin,Z%
Dpoke Intin+2,0
Vdisys
Spalette%(Z%,0)=Dpeek(Intout+2)
Spalette%(Z%,1)=Dpeek(Intout+4)
Spalette%(Z%,2)=Dpeek(Intout+6)
Next Z%
Return
'
Procedure Restore_pal
' --------------------- RESTORES PALETTE -------------------
' Dimensions: Spalette%(16,3)
'
For Z%=0 To 15
Dpoke Contrl,14
Dpoke Contrl+2,0
Dpoke Contrl+6,4
Dpoke Intin,Z%
Dpoke Intin+2,Spalette%(Z%,0)
Dpoke Intin+4,Spalette%(Z%,1)
Dpoke Intin+6,Spalette%(Z%,2)
Vdisys
Next Z%
Return
'
' #######################################################################